<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<title>DateUtil (POI API Documentation)</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="DateUtil (POI API Documentation)";
    }
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!--   -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/DateUtil.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/poi/ss/usermodel/DataValidationHelper.html" title="interface in org.apache.poi.ss.usermodel"><span class="strong">PREV CLASS</span></a></li>
<li><a href="../../../../../org/apache/poi/ss/usermodel/Drawing.html" title="interface in org.apache.poi.ss.usermodel"><span class="strong">NEXT CLASS</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/poi/ss/usermodel/DateUtil.html" target="_top">FRAMES</a></li>
<li><a href="DateUtil.html" target="_top">NO FRAMES</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_top");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>SUMMARY:&nbsp;</li>
<li>NESTED&nbsp;|&nbsp;</li>
<li><a href="#field_summary">FIELD</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">CONSTR</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">METHOD</a></li>
</ul>
<ul class="subNavList">
<li>DETAIL:&nbsp;</li>
<li><a href="#field_detail">FIELD</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">CONSTR</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">METHOD</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!--   -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<p class="subTitle">org.apache.poi.ss.usermodel</p>
<h2 title="Class DateUtil" class="title">Class DateUtil</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>org.apache.poi.ss.usermodel.DateUtil</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>Direct Known Subclasses:</dt>
<dd><a href="../../../../../org/apache/poi/hssf/usermodel/HSSFDateUtil.html" title="class in org.apache.poi.hssf.usermodel">HSSFDateUtil</a></dd>
</dl>
<hr>
<br>
<pre>public class <strong>DateUtil</strong>
extends java.lang.Object</pre>
<div class="block">Contains methods for dealing with Excel dates.</div>
<dl><dt><span class="strong">Author:</span></dt>
  <dd>Michael Harhen, Glen Stampoultzis (glens at apache.org), Dan Sherman (dsherman at isisph.com), Hack Kampbjorn (hak at 2mba.dk), Alex Jacoby (ajacoby at gmail.com), Pavel Krupets (pkrupets at palmtreebusiness dot com), Thies Wellpott</dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary">
<!--   -->
</a>
<h3>Field Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static long</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#DAY_MILLISECONDS">DAY_MILLISECONDS</a></strong></code>&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#HOURS_PER_DAY">HOURS_PER_DAY</a></strong></code>&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#MINUTES_PER_HOUR">MINUTES_PER_HOUR</a></strong></code>&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#SECONDS_PER_DAY">SECONDS_PER_DAY</a></strong></code>&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#SECONDS_PER_MINUTE">SECONDS_PER_MINUTE</a></strong></code>&nbsp;</td>
</tr>
</table>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!--   -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier</th>
<th class="colLast" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected </code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#DateUtil()">DateUtil</a></strong>()</code>&nbsp;</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!--   -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected static int</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#absoluteDay(java.util.Calendar, boolean)">absoluteDay</a></strong>(java.util.Calendar&nbsp;cal,
           boolean&nbsp;use1904windowing)</code>
<div class="block">Given a Calendar, return the number of days since 1900/12/31.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static double</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#convertTime(java.lang.String)">convertTime</a></strong>(java.lang.String&nbsp;timeStr)</code>
<div class="block">Converts a string of format "HH:MM" or "HH:MM:SS" to its (Excel) numeric equivalent</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static double</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#getExcelDate(java.util.Calendar, boolean)">getExcelDate</a></strong>(java.util.Calendar&nbsp;date,
            boolean&nbsp;use1904windowing)</code>
<div class="block">Given a Date in the form of a Calendar, converts it into a double
  representing its internal Excel representation, which is the
  number of days since 1/1/1900.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static double</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#getExcelDate(java.util.Date)">getExcelDate</a></strong>(java.util.Date&nbsp;date)</code>
<div class="block">Given a Date, converts it into a double representing its internal Excel representation,
   which is the number of days since 1/1/1900.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static double</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#getExcelDate(java.util.Date, boolean)">getExcelDate</a></strong>(java.util.Date&nbsp;date,
            boolean&nbsp;use1904windowing)</code>
<div class="block">Given a Date, converts it into a double representing its internal Excel representation,
   which is the number of days since 1/1/1900.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static java.util.Calendar</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#getJavaCalendar(double)">getJavaCalendar</a></strong>(double&nbsp;date)</code>
<div class="block">Get EXCEL date as Java Calendar (with default time zone).</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.util.Calendar</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#getJavaCalendar(double, boolean)">getJavaCalendar</a></strong>(double&nbsp;date,
               boolean&nbsp;use1904windowing)</code>
<div class="block">Get EXCEL date as Java Calendar (with default time zone).</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static java.util.Calendar</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#getJavaCalendar(double, boolean, java.util.TimeZone)">getJavaCalendar</a></strong>(double&nbsp;date,
               boolean&nbsp;use1904windowing,
               java.util.TimeZone&nbsp;timeZone)</code>
<div class="block">Get EXCEL date as Java Calendar with given time zone.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.util.Calendar</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#getJavaCalendar(double, boolean, java.util.TimeZone, boolean)">getJavaCalendar</a></strong>(double&nbsp;date,
               boolean&nbsp;use1904windowing,
               java.util.TimeZone&nbsp;timeZone,
               boolean&nbsp;roundSeconds)</code>
<div class="block">Get EXCEL date as Java Calendar with given time zone.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static java.util.Calendar</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#getJavaCalendarUTC(double, boolean)">getJavaCalendarUTC</a></strong>(double&nbsp;date,
                  boolean&nbsp;use1904windowing)</code>
<div class="block">Get EXCEL date as Java Calendar with UTC time zone.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.util.Date</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#getJavaDate(double)">getJavaDate</a></strong>(double&nbsp;date)</code>
<div class="block">Given an Excel date with using 1900 date windowing, and
   converts it to a java.util.Date.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static java.util.Date</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#getJavaDate(double, boolean)">getJavaDate</a></strong>(double&nbsp;date,
           boolean&nbsp;use1904windowing)</code>
<div class="block">Given an Excel date with either 1900 or 1904 date windowing,
  converts it to a java.util.Date.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.util.Date</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#getJavaDate(double, boolean, java.util.TimeZone)">getJavaDate</a></strong>(double&nbsp;date,
           boolean&nbsp;use1904windowing,
           java.util.TimeZone&nbsp;tz)</code>
<div class="block">Given an Excel date with either 1900 or 1904 date windowing,
  converts it to a java.util.Date.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static java.util.Date</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#getJavaDate(double, boolean, java.util.TimeZone, boolean)">getJavaDate</a></strong>(double&nbsp;date,
           boolean&nbsp;use1904windowing,
           java.util.TimeZone&nbsp;tz,
           boolean&nbsp;roundSeconds)</code>
<div class="block">Given an Excel date with either 1900 or 1904 date windowing,
  converts it to a java.util.Date.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.util.Date</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#getJavaDate(double, java.util.TimeZone)">getJavaDate</a></strong>(double&nbsp;date,
           java.util.TimeZone&nbsp;tz)</code>
<div class="block">Given an Excel date with using 1900 date windowing, and
  converts it to a java.util.Date.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#isADateFormat(int, java.lang.String)">isADateFormat</a></strong>(int&nbsp;formatIndex,
             java.lang.String&nbsp;formatString)</code>
<div class="block">Given a format ID and its format String, will check to see if the
  format represents a date format or not.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#isCellDateFormatted(org.apache.poi.ss.usermodel.Cell)">isCellDateFormatted</a></strong>(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a>&nbsp;cell)</code>
<div class="block">Check if a cell contains a date
  Since dates are stored internally in Excel as double values
  we infer it is a date if it is formatted as such.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#isCellInternalDateFormatted(org.apache.poi.ss.usermodel.Cell)">isCellInternalDateFormatted</a></strong>(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a>&nbsp;cell)</code>
<div class="block">Check if a cell contains a date, checking only for internal
   excel date formats.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#isInternalDateFormat(int)">isInternalDateFormat</a></strong>(int&nbsp;format)</code>
<div class="block">Given a format ID this will check whether the format represents
  an internal excel date format or not.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#isValidExcelDate(double)">isValidExcelDate</a></strong>(double&nbsp;value)</code>
<div class="block">Given a double, checks if it is a valid Excel date.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.util.Date</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#parseYYYYMMDDDate(java.lang.String)">parseYYYYMMDDDate</a></strong>(java.lang.String&nbsp;dateStr)</code>
<div class="block">Converts a string of format "YYYY/MM/DD" to its (Excel) numeric equivalent</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#setCalendar(java.util.Calendar, int, int, boolean, boolean)">setCalendar</a></strong>(java.util.Calendar&nbsp;calendar,
           int&nbsp;wholeDays,
           int&nbsp;millisecondsInDay,
           boolean&nbsp;use1904windowing,
           boolean&nbsp;roundSeconds)</code>&nbsp;</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!--   -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_detail">
<!--   -->
</a>
<h3>Field Detail</h3>
<a name="SECONDS_PER_MINUTE">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SECONDS_PER_MINUTE</h4>
<pre>public static final&nbsp;int SECONDS_PER_MINUTE</pre>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../constant-values.html#org.apache.poi.ss.usermodel.DateUtil.SECONDS_PER_MINUTE">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="MINUTES_PER_HOUR">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>MINUTES_PER_HOUR</h4>
<pre>public static final&nbsp;int MINUTES_PER_HOUR</pre>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../constant-values.html#org.apache.poi.ss.usermodel.DateUtil.MINUTES_PER_HOUR">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="HOURS_PER_DAY">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>HOURS_PER_DAY</h4>
<pre>public static final&nbsp;int HOURS_PER_DAY</pre>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../constant-values.html#org.apache.poi.ss.usermodel.DateUtil.HOURS_PER_DAY">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="SECONDS_PER_DAY">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SECONDS_PER_DAY</h4>
<pre>public static final&nbsp;int SECONDS_PER_DAY</pre>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../constant-values.html#org.apache.poi.ss.usermodel.DateUtil.SECONDS_PER_DAY">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="DAY_MILLISECONDS">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>DAY_MILLISECONDS</h4>
<pre>public static final&nbsp;long DAY_MILLISECONDS</pre>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../constant-values.html#org.apache.poi.ss.usermodel.DateUtil.DAY_MILLISECONDS">Constant Field Values</a></dd></dl>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!--   -->
</a>
<h3>Constructor Detail</h3>
<a name="DateUtil()">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>DateUtil</h4>
<pre>protected&nbsp;DateUtil()</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!--   -->
</a>
<h3>Method Detail</h3>
<a name="getExcelDate(java.util.Date)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getExcelDate</h4>
<pre>public static&nbsp;double&nbsp;getExcelDate(java.util.Date&nbsp;date)</pre>
<div class="block">Given a Date, converts it into a double representing its internal Excel representation,
   which is the number of days since 1/1/1900. Fractional days represent hours, minutes, and seconds.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>date</code> - the Date</dd>
<dt><span class="strong">Returns:</span></dt><dd>Excel representation of Date (-1 if error - test for error by checking for less than 0.1)</dd></dl>
</li>
</ul>
<a name="getExcelDate(java.util.Date, boolean)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getExcelDate</h4>
<pre>public static&nbsp;double&nbsp;getExcelDate(java.util.Date&nbsp;date,
                  boolean&nbsp;use1904windowing)</pre>
<div class="block">Given a Date, converts it into a double representing its internal Excel representation,
   which is the number of days since 1/1/1900. Fractional days represent hours, minutes, and seconds.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>date</code> - the Date</dd><dd><code>use1904windowing</code> - Should 1900 or 1904 date windowing be used?</dd>
<dt><span class="strong">Returns:</span></dt><dd>Excel representation of Date (-1 if error - test for error by checking for less than 0.1)</dd></dl>
</li>
</ul>
<a name="getExcelDate(java.util.Calendar, boolean)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getExcelDate</h4>
<pre>public static&nbsp;double&nbsp;getExcelDate(java.util.Calendar&nbsp;date,
                  boolean&nbsp;use1904windowing)</pre>
<div class="block">Given a Date in the form of a Calendar, converts it into a double
  representing its internal Excel representation, which is the
  number of days since 1/1/1900. Fractional days represent hours,
  minutes, and seconds.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>date</code> - the Calendar holding the date to convert</dd><dd><code>use1904windowing</code> - Should 1900 or 1904 date windowing be used?</dd>
<dt><span class="strong">Returns:</span></dt><dd>Excel representation of Date (-1 if error - test for error by checking for less than 0.1)</dd></dl>
</li>
</ul>
<a name="getJavaDate(double, java.util.TimeZone)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getJavaDate</h4>
<pre>public static&nbsp;java.util.Date&nbsp;getJavaDate(double&nbsp;date,
                         java.util.TimeZone&nbsp;tz)</pre>
<div class="block">Given an Excel date with using 1900 date windowing, and
  converts it to a java.util.Date.
  
  Excel Dates and Times are stored without any timezone 
  information. If you know (through other means) that your file 
  uses a different TimeZone to the system default, you can use
  this version of the getJavaDate() method to handle it.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>date</code> - The Excel date.</dd><dd><code>tz</code> - The TimeZone to evaluate the date in</dd>
<dt><span class="strong">Returns:</span></dt><dd>Java representation of the date, or null if date is not a valid Excel date</dd></dl>
</li>
</ul>
<a name="getJavaDate(double)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getJavaDate</h4>
<pre>public static&nbsp;java.util.Date&nbsp;getJavaDate(double&nbsp;date)</pre>
<div class="block">Given an Excel date with using 1900 date windowing, and
   converts it to a java.util.Date.

  NOTE: If the default <code>TimeZone</code> in Java uses Daylight
  Saving Time then the conversion back to an Excel date may not give
  the same value, that is the comparison
  <CODE>excelDate == getExcelDate(getJavaDate(excelDate,false))</CODE>
  is not always true. For example if default timezone is
  <code>Europe/Copenhagen</code>, on 2004-03-28 the minute after
  01:59 CET is 03:00 CEST, if the excel date represents a time between
  02:00 and 03:00 then it is converted to past 03:00 summer time</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>date</code> - The Excel date.</dd>
<dt><span class="strong">Returns:</span></dt><dd>Java representation of the date, or null if date is not a valid Excel date</dd><dt><span class="strong">See Also:</span></dt><dd><code>TimeZone</code></dd></dl>
</li>
</ul>
<a name="getJavaDate(double, boolean, java.util.TimeZone)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getJavaDate</h4>
<pre>public static&nbsp;java.util.Date&nbsp;getJavaDate(double&nbsp;date,
                         boolean&nbsp;use1904windowing,
                         java.util.TimeZone&nbsp;tz)</pre>
<div class="block">Given an Excel date with either 1900 or 1904 date windowing,
  converts it to a java.util.Date.
  
  Excel Dates and Times are stored without any timezone 
  information. If you know (through other means) that your file 
  uses a different TimeZone to the system default, you can use
  this version of the getJavaDate() method to handle it.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>date</code> - The Excel date.</dd><dd><code>tz</code> - The TimeZone to evaluate the date in</dd><dd><code>use1904windowing</code> - true if date uses 1904 windowing,
   or false if using 1900 date windowing.</dd>
<dt><span class="strong">Returns:</span></dt><dd>Java representation of the date, or null if date is not a valid Excel date</dd></dl>
</li>
</ul>
<a name="getJavaDate(double, boolean, java.util.TimeZone, boolean)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getJavaDate</h4>
<pre>public static&nbsp;java.util.Date&nbsp;getJavaDate(double&nbsp;date,
                         boolean&nbsp;use1904windowing,
                         java.util.TimeZone&nbsp;tz,
                         boolean&nbsp;roundSeconds)</pre>
<div class="block">Given an Excel date with either 1900 or 1904 date windowing,
  converts it to a java.util.Date.
  
  Excel Dates and Times are stored without any timezone 
  information. If you know (through other means) that your file 
  uses a different TimeZone to the system default, you can use
  this version of the getJavaDate() method to handle it.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>date</code> - The Excel date.</dd><dd><code>tz</code> - The TimeZone to evaluate the date in</dd><dd><code>use1904windowing</code> - true if date uses 1904 windowing,
   or false if using 1900 date windowing.</dd><dd><code>roundSeconds</code> - round to closest second</dd>
<dt><span class="strong">Returns:</span></dt><dd>Java representation of the date, or null if date is not a valid Excel date</dd></dl>
</li>
</ul>
<a name="getJavaDate(double, boolean)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getJavaDate</h4>
<pre>public static&nbsp;java.util.Date&nbsp;getJavaDate(double&nbsp;date,
                         boolean&nbsp;use1904windowing)</pre>
<div class="block">Given an Excel date with either 1900 or 1904 date windowing,
  converts it to a java.util.Date.

  NOTE: If the default <code>TimeZone</code> in Java uses Daylight
  Saving Time then the conversion back to an Excel date may not give
  the same value, that is the comparison
  <CODE>excelDate == getExcelDate(getJavaDate(excelDate,false))</CODE>
  is not always true. For example if default timezone is
  <code>Europe/Copenhagen</code>, on 2004-03-28 the minute after
  01:59 CET is 03:00 CEST, if the excel date represents a time between
  02:00 and 03:00 then it is converted to past 03:00 summer time</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>date</code> - The Excel date.</dd><dd><code>use1904windowing</code> - true if date uses 1904 windowing,
   or false if using 1900 date windowing.</dd>
<dt><span class="strong">Returns:</span></dt><dd>Java representation of the date, or null if date is not a valid Excel date</dd><dt><span class="strong">See Also:</span></dt><dd><code>TimeZone</code></dd></dl>
</li>
</ul>
<a name="setCalendar(java.util.Calendar, int, int, boolean, boolean)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setCalendar</h4>
<pre>public static&nbsp;void&nbsp;setCalendar(java.util.Calendar&nbsp;calendar,
               int&nbsp;wholeDays,
               int&nbsp;millisecondsInDay,
               boolean&nbsp;use1904windowing,
               boolean&nbsp;roundSeconds)</pre>
</li>
</ul>
<a name="getJavaCalendar(double)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getJavaCalendar</h4>
<pre>public static&nbsp;java.util.Calendar&nbsp;getJavaCalendar(double&nbsp;date)</pre>
<div class="block">Get EXCEL date as Java Calendar (with default time zone).
 This is like <a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#getJavaDate(double)"><code>getJavaDate(double)</code></a> but returns a Calendar object.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>date</code> - The Excel date.</dd>
<dt><span class="strong">Returns:</span></dt><dd>Java representation of the date, or null if date is not a valid Excel date</dd></dl>
</li>
</ul>
<a name="getJavaCalendar(double, boolean)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getJavaCalendar</h4>
<pre>public static&nbsp;java.util.Calendar&nbsp;getJavaCalendar(double&nbsp;date,
                                 boolean&nbsp;use1904windowing)</pre>
<div class="block">Get EXCEL date as Java Calendar (with default time zone).
 This is like <a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#getJavaDate(double, boolean)"><code>getJavaDate(double, boolean)</code></a> but returns a Calendar object.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>date</code> - The Excel date.</dd><dd><code>use1904windowing</code> - true if date uses 1904 windowing,
   or false if using 1900 date windowing.</dd>
<dt><span class="strong">Returns:</span></dt><dd>Java representation of the date, or null if date is not a valid Excel date</dd></dl>
</li>
</ul>
<a name="getJavaCalendarUTC(double, boolean)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getJavaCalendarUTC</h4>
<pre>public static&nbsp;java.util.Calendar&nbsp;getJavaCalendarUTC(double&nbsp;date,
                                    boolean&nbsp;use1904windowing)</pre>
<div class="block">Get EXCEL date as Java Calendar with UTC time zone.
 This is similar to <a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#getJavaDate(double, boolean)"><code>getJavaDate(double, boolean)</code></a> but returns a
 Calendar object that has UTC as time zone, so no daylight saving hassle.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>date</code> - The Excel date.</dd><dd><code>use1904windowing</code> - true if date uses 1904 windowing,
  or false if using 1900 date windowing.</dd>
<dt><span class="strong">Returns:</span></dt><dd>Java representation of the date in UTC, or null if date is not a valid Excel date</dd></dl>
</li>
</ul>
<a name="getJavaCalendar(double, boolean, java.util.TimeZone)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getJavaCalendar</h4>
<pre>public static&nbsp;java.util.Calendar&nbsp;getJavaCalendar(double&nbsp;date,
                                 boolean&nbsp;use1904windowing,
                                 java.util.TimeZone&nbsp;timeZone)</pre>
<div class="block">Get EXCEL date as Java Calendar with given time zone.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>date</code> - The Excel date.</dd><dd><code>use1904windowing</code> - true if date uses 1904 windowing,
  or false if using 1900 date windowing.</dd><dd><code>timeZone</code> - The TimeZone to evaluate the date in</dd>
<dt><span class="strong">Returns:</span></dt><dd>Java representation of the date, or null if date is not a valid Excel date</dd></dl>
</li>
</ul>
<a name="getJavaCalendar(double, boolean, java.util.TimeZone, boolean)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getJavaCalendar</h4>
<pre>public static&nbsp;java.util.Calendar&nbsp;getJavaCalendar(double&nbsp;date,
                                 boolean&nbsp;use1904windowing,
                                 java.util.TimeZone&nbsp;timeZone,
                                 boolean&nbsp;roundSeconds)</pre>
<div class="block">Get EXCEL date as Java Calendar with given time zone.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>date</code> - The Excel date.</dd><dd><code>use1904windowing</code> - true if date uses 1904 windowing,
  or false if using 1900 date windowing.</dd><dd><code>timeZone</code> - The TimeZone to evaluate the date in</dd><dd><code>roundSeconds</code> - round to closest second</dd>
<dt><span class="strong">Returns:</span></dt><dd>Java representation of the date, or null if date is not a valid Excel date</dd></dl>
</li>
</ul>
<a name="isADateFormat(int, java.lang.String)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isADateFormat</h4>
<pre>public static&nbsp;boolean&nbsp;isADateFormat(int&nbsp;formatIndex,
                    java.lang.String&nbsp;formatString)</pre>
<div class="block">Given a format ID and its format String, will check to see if the
  format represents a date format or not.
 Firstly, it will check to see if the format ID corresponds to an
  internal excel date format (eg most US date formats)
 If not, it will check to see if the format string only contains
  date formatting characters (ymd-/), which covers most
  non US date formats.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>formatIndex</code> - The index of the format, eg from ExtendedFormatRecord.getFormatIndex</dd><dd><code>formatString</code> - The format string, eg from FormatRecord.getFormatString</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#isInternalDateFormat(int)"><code>isInternalDateFormat(int)</code></a></dd></dl>
</li>
</ul>
<a name="isInternalDateFormat(int)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isInternalDateFormat</h4>
<pre>public static&nbsp;boolean&nbsp;isInternalDateFormat(int&nbsp;format)</pre>
<div class="block">Given a format ID this will check whether the format represents
  an internal excel date format or not.</div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#isADateFormat(int, java.lang.String)"><code>isADateFormat(int, java.lang.String)</code></a></dd></dl>
</li>
</ul>
<a name="isCellDateFormatted(org.apache.poi.ss.usermodel.Cell)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isCellDateFormatted</h4>
<pre>public static&nbsp;boolean&nbsp;isCellDateFormatted(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a>&nbsp;cell)</pre>
<div class="block">Check if a cell contains a date
  Since dates are stored internally in Excel as double values
  we infer it is a date if it is formatted as such.</div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#isADateFormat(int, java.lang.String)"><code>isADateFormat(int, String)</code></a>, 
<a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#isInternalDateFormat(int)"><code>isInternalDateFormat(int)</code></a></dd></dl>
</li>
</ul>
<a name="isCellInternalDateFormatted(org.apache.poi.ss.usermodel.Cell)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isCellInternalDateFormatted</h4>
<pre>public static&nbsp;boolean&nbsp;isCellInternalDateFormatted(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a>&nbsp;cell)</pre>
<div class="block">Check if a cell contains a date, checking only for internal
   excel date formats.
  As Excel stores a great many of its dates in "non-internal"
   date formats, you will not normally want to use this method.</div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#isADateFormat(int, java.lang.String)"><code>isADateFormat(int,String)</code></a>, 
<a href="../../../../../org/apache/poi/ss/usermodel/DateUtil.html#isInternalDateFormat(int)"><code>isInternalDateFormat(int)</code></a></dd></dl>
</li>
</ul>
<a name="isValidExcelDate(double)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isValidExcelDate</h4>
<pre>public static&nbsp;boolean&nbsp;isValidExcelDate(double&nbsp;value)</pre>
<div class="block">Given a double, checks if it is a valid Excel date.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>value</code> - the double value</dd>
<dt><span class="strong">Returns:</span></dt><dd>true if valid</dd></dl>
</li>
</ul>
<a name="absoluteDay(java.util.Calendar, boolean)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>absoluteDay</h4>
<pre>protected static&nbsp;int&nbsp;absoluteDay(java.util.Calendar&nbsp;cal,
              boolean&nbsp;use1904windowing)</pre>
<div class="block">Given a Calendar, return the number of days since 1900/12/31.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>cal</code> - the Calendar</dd>
<dt><span class="strong">Returns:</span></dt><dd>days number of days since 1900/12/31</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if date is invalid</dd></dl>
</li>
</ul>
<a name="convertTime(java.lang.String)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>convertTime</h4>
<pre>public static&nbsp;double&nbsp;convertTime(java.lang.String&nbsp;timeStr)</pre>
<div class="block">Converts a string of format "HH:MM" or "HH:MM:SS" to its (Excel) numeric equivalent</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>a double between 0 and 1 representing the fraction of the day</dd></dl>
</li>
</ul>
<a name="parseYYYYMMDDDate(java.lang.String)">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>parseYYYYMMDDDate</h4>
<pre>public static&nbsp;java.util.Date&nbsp;parseYYYYMMDDDate(java.lang.String&nbsp;dateStr)</pre>
<div class="block">Converts a string of format "YYYY/MM/DD" to its (Excel) numeric equivalent</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>a double representing the (integer) number of days since the start of the Excel epoch</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!--   -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/DateUtil.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/poi/ss/usermodel/DataValidationHelper.html" title="interface in org.apache.poi.ss.usermodel"><span class="strong">PREV CLASS</span></a></li>
<li><a href="../../../../../org/apache/poi/ss/usermodel/Drawing.html" title="interface in org.apache.poi.ss.usermodel"><span class="strong">NEXT CLASS</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/poi/ss/usermodel/DateUtil.html" target="_top">FRAMES</a></li>
<li><a href="DateUtil.html" target="_top">NO FRAMES</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_bottom");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>SUMMARY:&nbsp;</li>
<li>NESTED&nbsp;|&nbsp;</li>
<li><a href="#field_summary">FIELD</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">CONSTR</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">METHOD</a></li>
</ul>
<ul class="subNavList">
<li>DETAIL:&nbsp;</li>
<li><a href="#field_detail">FIELD</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">CONSTR</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">METHOD</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!--   -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>
                <i>Copyright 2014 The Apache Software Foundation or
        its licensors, as applicable.</i>
            </small></p>
</body>
</html>
